<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib prefix="sx" uri="/struts-dojo-tags" %>

<script type="text/javascript" src="<s:url value="/js/investigator.js"/>"></script>

<s:div id="staff_content" cssStyle="width: 100%">
    <div id="filter" >
        <s:form action="list" cssClass="tableFilter"  >
            <tr>
                <th colspan="4" class="tableTitle">
                    <h5>Search</h5>
                </th>
            </tr>
            <tr>
                <td>
                      <label>Name:</label>
                </td>
                <td>
                    <s:textfield label="Name" name="nombre" value="%{nombre}" theme="simple" />
                </td>
            </tr>
            <tr>
                <td>
                    <label>Surname:</label>
                </td>
                <td>
                    <s:textfield label="Surname" name="apellido" value="%{apellido}" theme="simple" />
                </td>
            </tr>
            <tr>
                <td>
                    <label>Site:</label>
                </td>
                <td>
                    <s:select theme="simple" list="sites" listKey="id" name="centro.id" listValue="institucion" label="Site" headerKey="-1" headerValue="Choose a Site"/>
                </td>
                <td></td>
                <td></td>
            </tr>
                <s:doubleselect
                                  id="areas"
                                  label="Therapeutic Area"
                                  cssClass="areass"
                                  list="languageMap.keySet()"
                                  listKey="id"
                                  listValue="name"
                                  name="therapeuticArea.id"
                                  value="%{therapeuticArea.id}"
                                  doubleId="specialities"
                                  doubleHeaderKey="-1" doubleHeaderValue="Choose Specialty"
                                  doubleListKey="id"
                                  doubleListValue="name"
                                  doubleName="speciality.id"
                                  doubleValue="%{speciality.id}"
                                  doubleList="languageMap.get(top)"
                                  ></s:doubleselect>


            <tr>
                <td colspan="4" class="centeredButtons"><s:submit value="Search" name="filter" theme="simple"/>
                    <s:submit action="create" value="New" theme="simple" onclick="resetForms();"/></td>
            </tr>
        </s:form>
    </div>
    <s:if test="!list.isEmpty()">
        <div id="table_content">
            <table class="paginated-table" >
                <thead>
                <tr>
                    <th>Name</th>
                    <th>Surname</th>
                    <th>Site</th>
                    <th>Phone</th>
                    <th>E-Mail</th>
                    <th>Edit</th>
                </tr>
                </thead>
                <tbody>
                <s:iterator value="list">
                    <tr>
                        <th><s:property value="nombre"/></th>
                        <th><s:property value="apellido"/></th>
                        <th>
                            <s:if test="centro != null || centro.institucion != null">
                                <s:property value="centro.institucion"/>
                            </s:if>
                            <s:else>
                                N/A
                            </s:else>
                        </th>
                        <th><s:property value="phone"/></th>
                        <th><a href="mailto:<s:property value="email"/>"><s:property value="email"/></a></th>


                        <th>
                            <s:form action="edit" method="POST">
                            <s:hidden value="%{id}" name="editableInvolucradoId" theme="simple"/>
                            <a onclick="$(this).closest('form').submit()"><img src="<s:url value="/images/edit.png"/>" title="Edit" alt="Edit"></a></TH>
                        </s:form>
                        </th>
                    </tr>
                </s:iterator>

                </tbody>
            </table>
            <div style="width: 100%;text-align: center" >
                <span class="prev" style="" >Previous</span><span class="next">Next</span>
            </div>

            <script type="text/javascript">
                paginar(10);
            </script>
        </div>
    </s:if>
</s:div>
<script type="text/javascript">
    var list = true;
</script>

<script type="text/javascript">
    $('#allSiteStaff').css({"color":"#EE5102","fontWeight":"bold"});
</script>
